<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
	xmlns:cs="http://myfaces.apress.com/custom" template="/WEB-INF/layouts/standard.xhtml"
	xmlns:a4j="http://richfaces.org/a4j" xmlns:rich="http://richfaces.org/rich" xmlns:bf="http://www.bssmanager.com/jsf"
	xmlns:c="http://java.sun.com/jstl/core">


	<ui:define name="content">
		<h:form id="idGenerationController">
			<table style="table-layout: fixed; border: thin solid gray;">
				<tr class="norender">
					<td colspan="6" style="background-color: #FFBF80; font-weight: bolder; font-size: 10pt;" align="left">Select
						Patient</td>
				</tr>
				<tr class="norender">
					<td colspan="1" align="left"><h:outputLabel value="Patient's Name:" />
					</td>
					<td colspan="2" align="left"><h:inputText id="patients" /> <rich:suggestionbox for="patients" status="valsub"
							suggestionAction="#{idGenerationController.admissions}" minChars="2" nothingLabel="Not found" var="result">
							<h:column>
								<h:outputText value="#{result.patient.firstName} #{result.patient.middleName} #{result.patient.lastName}" />
							</h:column>
							<a4j:support event="onselect" action="#{idGenerationController.select}" reRender="selectedPatient"
								status="valsub" />
						</rich:suggestionbox>
					</td>
					<td colspan="1" align="left"><a4j:status forceId="true" id="valsub">
							<f:facet name="start">
								<h:graphicImage value="/images/im1.gif" />
							</f:facet>
						</a4j:status>
					</td>
					<td colspan="2" align="left"><h:commandButton value="Print" onclick="return false;" />
					</td>
				</tr>
				<tr class="norender">
					<td colspan="6" style="background-color: #FFBF80; font-weight: bolder; font-size: 10pt;" align="center">
						Patient Details</td>
				</tr>
				<tr>
					<td colspan="6" valign="top">
						<h:panelGroup id="selectedPatient">
							<div>
								<div align="center" style="text-align: center">
									<div style="font-size: 16pt; padding: 0px;">HOME FOR CANCER PATIENTS</div>
									<div style="font-size: 12pt;">BHARAT SEVASHRAM SANGHA</div>
									<div style="font-size: 10pt;">PLOT NO.263, SW.PRANAVANANDAJI MARG,SECTOR-31A, VASHI,NAVI MUMBAI-400703</div>
									<div style="font-size: 10pt;">TEL.:2781-1327</div>
								</div>
								<hr />
								<div style="font-size: 14pt;">ID CARD</div>
							</div>
							<table width="100%" align="left" style="margin-top: 30px;">
								<tr>
									<td valign="top">
										<table width="100%" align="left" style="text-align: left; table-layout: fixed">
											<tr>
												<td valign="top"><h:graphicImage url="/bss/images/saved?id=#{idGenerationController.model.patient.id}"
														alt="" width="320" height="240" style="border:thin solid gray;" />
												</td>
												<td valign="top"><h:panelGrid columns="2">
														<h:outputLabel value="ID: " />
														<h:outputText value="#{idGenerationController.model.id}" />
														<h:outputLabel value="Name:" />
														<h:outputText
															value="#{idGenerationController.model.patient.firstName} #{idGenerationController.model.patient.middleName} #{idGenerationController.model.patient.lastName}" />
														<h:outputLabel value="Address:" />
														<h:outputText value="#{idGenerationController.model.patient.address}" />
														<h:outputLabel value="Case Number:" />
														<h:outputText value="#{idGenerationController.model.caseNo}" />
														<h:outputLabel value="Stay from: " />
														<h:outputText value="#{idGenerationController.model.dateFrom}">
															<f:convertDateTime pattern="dd MMM yyyy" />
														</h:outputText>
														<h:outputLabel value="Stay to: " />
														<h:outputText value="#{idGenerationController.model.dateTo}">
															<f:convertDateTime pattern="dd MMM yyyy" />
														</h:outputText>														
													</h:panelGrid> <h:panelGrid columns="1">
														<f:facet name="header">
															<h:outputLabel value="Attendents" />
														</f:facet>
														<c:forEach items="#{idGenerationController.model.currentAttendents}" var="aBean" varStatus="ii">
															<h:outputText value="#{ii.index+1})  #{aBean.attendent.name}" />
														</c:forEach>
														<c:if test="#{empty idGenerationController.model.currentAttendents}">
															<h:outputText value="No Attendents" />
														</c:if>
													</h:panelGrid>
												</td>
											</tr>
											<tr>
												<td colspan="2" valign="top" align="left" style="padding-top: 25px;">
													<table>
														<tr>
															<td valign="top" style="border-right: thin solid gray"><h:panelGrid columns="1">
																	<f:facet name="header">
																		<h:outputLabel value="Rooms" />
																	</f:facet>
																	<c:forEach items="#{idGenerationController.model.roomBookings}" var="roomBooking">
																		<h:outputText value="#{roomBooking.room.roomNumber} ( #{roomBooking.room.building.name} )" />
																	</c:forEach>
																	<c:if test="#{empty idGenerationController.model.roomBookings}">
																		<h:outputText value="No Rooms Booked" />
																	</c:if>
																</h:panelGrid> <h:panelGrid columns="1">
																	<f:facet name="header">
																		<h:outputLabel value="Dormitory Beds: " />
																	</f:facet>
																	<c:forEach items="#{idGenerationController.model.bedBookings}" var="bedBooking">
																		<h:outputText
																			value="#{bedBooking.bed.bedNumber} ( #{bedBooking.bed.room.building.name} - #{bedBooking.bed.room.roomNumber} )" />
																	</c:forEach>
																	<c:if test="#{empty idGenerationController.model.bedBookings}">
																		<h:outputText value="No Beds Booked" />
																	</c:if>
																</h:panelGrid></td>


															<td valign="top" style="border-right: thin solid gray"><h:panelGrid columns="4">
																	<f:facet name="header">
																		<h:outputLabel value="Material Set" />
																	</f:facet>
																	<c:forEach items="#{idGenerationController.model.materialAllocations}" var="materialAllocation">
																		<h:outputLabel value="#{materialAllocation.materialType.name}" />
																		<h:outputText value="#{materialAllocation.instances}"
																			style="width: 15px; margin-right:15px; text-align: center;" />
																	</c:forEach>
																</h:panelGrid>
															</td>

															<td valign="top"><h:panelGrid>
																	<f:facet name="header">
																		<h:outputLabel value="Utensil Set" />
																	</f:facet>
																	<h:outputText value="#{idGenerationController.model.materialSet}" converter="#{materialSetConverter}" />
																	<h:outputText value="Deposit: #{idGenerationController.model.materialSet.deposit}" />
																</h:panelGrid>
															</td>
														</tr>
													</table></td>
											</tr>
										</table></td>
								</tr>

							</table>
						</h:panelGroup></td>
				</tr>
				<tr style="height: 75px" />
				<tr class="noscreen">
					<td colspan="5" />
					<td align="right" valign="top" colspan="1">Secretary</td>
				</tr>
				<tr style="height: 25px" class="noscreen" />
				<tr class="noscreen">
					<td align="left" valign="top" colspan="6"><h:outputLabel value="Guidelines and Instructions"
							style="font-size: 12pt;" />
						<hr /> <h:panelGrid columns="1">
							<c:forEach items="#{guidelinesDao.all}" var="guide" varStatus="ii">
								<h:outputText value="#{ii.index+1}) #{guide.description}" style="font-size: 8pt;" />
							</c:forEach>
						</h:panelGrid></td>
				</tr>
				<tr style="height: 20px" class="noscreen">
					<td colspan="6">
						<hr /></td>
				</tr>
				<tr class="noscreen">
					<td colspan="6">
						<table cellpadding="0" cellspacing="0">
							<tr>
								<td style="border-right: thin solid gray; padding-right: 10px" align="left" valign="top">
									<div>Received all materials as detailed and ID card</div> <br />
								<br />
								<br />
									<div>
										<span style="float: right">Date</span><span style="float: left">Signature of attendant</span>
									</div></td>
								<td align="left" valign="top" style="padding-left: 15px">
									<div>Received refund of security deposits as full and final settlement</div> <br />
								<br />
								<br />
									<div>
										<span style="float: right">Date</span><span style="float: left">Signature of attendant</span>
									</div></td>
							</tr>
						</table></td>
				</tr>
			</table>

		</h:form>

	</ui:define>
</ui:composition>